package cliente_diseno2011;

import javax.swing.JPanel;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.TextField;

import javax.swing.JButton;
import javax.swing.BoxLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.ImageIcon;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JSlider;
import javax.swing.JScrollBar;
import javax.swing.JSpinner;

public class Login extends JPanel {

	/**
	 * Create the panel.
	 */
	JButton btnNewButton;
	private JTextField textField;

	public Login() {

		btnNewButton = new JButton("Ingresar tarjeta");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});

		textField = new JTextField();
		textField.setColumns(10);

		Image gob = new ImageIcon("./src/img/gob2.jpg").getImage();
		JPanel panel = new BoletaPanel(gob);

		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout
				.setHorizontalGroup(groupLayout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								groupLayout
										.createSequentialGroup()
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																groupLayout
																		.createSequentialGroup()
																		.addGap(101)
																		.addComponent(
																				btnNewButton)
																		.addGap(26)
																		.addComponent(
																				textField,
																				GroupLayout.PREFERRED_SIZE,
																				GroupLayout.DEFAULT_SIZE,
																				GroupLayout.PREFERRED_SIZE))
														.addGroup(
																groupLayout
																		.createSequentialGroup()
																		.addGap(91)
																		.addComponent(
																				panel,
																				GroupLayout.PREFERRED_SIZE,
																				251,
																				GroupLayout.PREFERRED_SIZE)))
										.addContainerGap(108, Short.MAX_VALUE)));
		groupLayout
				.setVerticalGroup(groupLayout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								groupLayout
										.createSequentialGroup()
										.addGap(61)
										.addComponent(panel,
												GroupLayout.PREFERRED_SIZE, 82,
												GroupLayout.PREFERRED_SIZE)
										.addGap(54)
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																textField,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnNewButton))
										.addContainerGap(80, Short.MAX_VALUE)));
		setLayout(groupLayout);

	}

	public void addTarjetaListener(ActionListener al) {
		btnNewButton.addActionListener(al);
	}

	public String getTarjeta() {
		return textField.getText();

	}
}
